package com.nineclock.signIn.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.nineclock.signIn.pojo.SignInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author : Liu
 * @date : 2021/12/1 0001 15:59
 */
public interface SignInfoMapper extends BaseMapper<SignInfo> {

    /*@Select("select company_id,company_user_id,create_date\n" +
            "from sign_info \n" +
            "where company_user_id in (select distinct company_user_id from sign_info ${ew.customSqlSegment})\n" +
            "group by company_id,create_date,company_user_id\n" +
            "order by create_date asc")*/
//    public List<SignInfo> querySignInfo(@Param("start") String start, @Param("end") String end);
    @Select("select distinct company_user_id from sign_info ${ew.customSqlSegment}")
    IPage<SignInfo> selectMyPage(IPage<SignInfo> page, @Param(Constants.WRAPPER) Wrapper<SignInfo> queryWrapper);



    @Select("SELECT DISTINCT company_user_id FROM sign_info where company_id=#{companyId} and create_date BETWEEN #{startTime} AND #{endTime}")
    List<SignInfo> queryCompanyUserId(@Param("companyId") Long companyId,@Param("startTime") String startTime,@Param("endTime") String endTime );
}
